#pragma once
#include <boost/graph/depth_first_search.hpp>
#include "ASTreeCommon.h"

namespace AST {

class DiffVisitor : public boost::default_dfs_visitor
{
public:
	enum VisitMode{VISIT_ONLY, VISIT_AND_MATCH_INNER, PROPAGATE_CHANGES};
	DiffVisitor(void);
	DiffVisitor(VisitMode mode, NodeMatchesMap* mapForMatches = NULL, std::set<Node*>* changeSet= NULL);
	~DiffVisitor(void);
	void discover_vertex(vertexDesc v, const Graph & g);
	void initialize_vertex(vertexDesc v,const Graph & g);
	void back_edge(edgeDesc e, const Graph & g);
	void forward_or_cross_edge(edgeDesc e, const Graph & g);
	void tree_edge(edgeDesc e, const Graph & g);
	void finish_vertex(vertexDesc v, const Graph & g);
	void start_vertex(vertexDesc v, const Graph & g);
	VisitMode mode (void) const;
protected:
	VisitMode vMode;
	NodeMatchesMap* matchingNodesMap;
	std::set<Node*>* changedFunctionsAndMethods;
};

}//namespace AST


